package com.sdry.service.impl.llm;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.sdry.mapper.llm.PermissionMapper;
import com.sdry.model.llm.Menu;
import com.sdry.model.llm.Permission;
import com.sdry.service.llm.PermissionService;
import com.sdry.utils.MenuUtils;

/** 
* 权限service实现类
* @author lian 
* @version 1.0
* @time 2018年10月18日 下午5:04:32
*/

@Service
public class PermissionServiceImp implements PermissionService {

	@Resource
	private PermissionMapper permissionMapper;  //注入权限mapper
	
	/**
	 * 根据用户ID获取对应的权限
	 * @param userId
	 * @return
	 */
	public List<Menu> findByUserId(Long userId){
		List<Permission> permissions = permissionMapper.findPermissionByUserId(userId);
		return MenuUtils.permission2menu(permissions);
	}
}
